package adv42;

/**
 * @author oldliu
 * @since 1.0
 */
public class ThreadYield extends Thread {
    public ThreadYield(String n){
        super(n);
    }

    @Override
    public void run() {
        for (int i = 1; i <=50 ; i++) {
            System.out.println(super.getName()+" 打印了 "+i);
            Thread.yield();
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i <= 5; i++) {
            new ThreadYield("线程"+i).start();
        }
    }
}
